package svc

import (
	"api/internal/config"
	"api/internal/middleware"
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"srv/realnameclient"
)

type ServiceContext struct {
	Config    config.Config
	UserValid rest.Middleware
	Srv       realnameclient.Realname
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:    c,
		UserValid: middleware.NewUserValidMiddleware().Handle,
		Srv:       realnameclient.NewRealname(zrpc.MustNewClient(c.Srv)),
	}
}
